package com.tinysand.advert.entity.condition;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 推广单元的兴趣限制实体类定义；只有请求中有对应的兴趣才会推广对应广告
 *
 * Created By TINY
 * Create Time 2020/2/15
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "ad_unit_it")
@EntityListeners(AuditingEntityListener.class) // 使用JPA审计自动维护日期
public class AdUnitInterest {

    /* 推广单元兴趣限制表自增主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    /* 关联推广单元的主键 */
    @Column(name = "unit_id", nullable = false)
    private Long unitId;

    /* 兴趣标签 */
    @Column(name = "it_tag", nullable = false)
    private String itTag;

    public AdUnitInterest(Long unitId, String itTag) {
        this.unitId = unitId;
        this.itTag = itTag;
    }
}
